// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   smtp_ok.java

package security.config.key;

import include.nseer_db.nseer_db;
import include.tree_index.Nseer;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.*;

public class smtp_ok extends HttpServlet
{

	public smtp_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession session = request.getSession();
		Nseer n = new Nseer();
		String Mailhost = request.getParameter("Mailhost");
		String eName = request.getParameter("eName");
		String ePwd = request.getParameter("ePwd");
		nseer_db erpplatform_db = new nseer_db((String)session.getAttribute("unit_db_name"));
		String sql = "select * from erpplatform_config_public_char where kind='mailhost'";
		ResultSet rs = erpplatform_db.executeQuery(sql);
		try
		{
			if (rs.next())
			{
				sql = (new StringBuilder("update erpplatform_config_public_char set type_name='")).append(Mailhost).append("',describe1='").append(eName).append("',describe2='").append(n.E(ePwd)).append("' where kind='mailhost'").toString();
				erpplatform_db.executeUpdate(sql);
			} else
			{
				sql = (new StringBuilder("insert into erpplatform_config_public_char(kind,type_name,describe1,describe2) values ('mailhost','")).append(Mailhost).append("','").append(eName).append("','").append(n.E(ePwd)).append("')").toString();
				erpplatform_db.executeUpdate(sql);
			}
			erpplatform_db.close();
			response.sendRedirect("security/config/key/smtp_ok.jsp");
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}
	}
}
